package net.melon.logger.pojo;

import java.util.Date;

import net.esj.basic.pojo.AbstractPojo;
import net.esj.basic.utils.DateFormat;

public class Logger extends AbstractPojo<String> {

	private String id;
	private String operatorId;
	private String operatorName;
	private String operatorType;
	private String message;
	private String methodId;
	private Date gmtCreate;
	
	private LoggerMethod method;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getOperatorId() {
		return operatorId;
	}
	public void setOperatorId(String operatorId) {
		this.operatorId = operatorId;
	}
	public String getOperatorName() {
		return operatorName;
	}
	public void setOperatorName(String operatorName) {
		this.operatorName = operatorName;
	}
	public String getOperatorType() {
		return operatorType;
	}
	public void setOperatorType(String operatorType) {
		this.operatorType = operatorType;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public String getMethodId() {
		return methodId;
	}
	public void setMethodId(String methodId) {
		this.methodId = methodId;
	}
	public Date getGmtCreate() {
		return gmtCreate;
	}
	public void setGmtCreate(Date gmtCreate) {
		this.gmtCreate = gmtCreate;
	}
	
	public LoggerMethod getMethod() {
		return method;
	}
	public void setMethod(LoggerMethod method) {
		this.method = method;
	}
	
	public String toString(){
		StringBuilder sb= new StringBuilder();
		sb.append(DateFormat.formateDateTime(gmtCreate, DateFormat.DEFAULT_DATETIME_FORMAT_SEC));
		sb.append(" ");
		sb.append(method.getActionName()).append(".").append(method.getMethodName()).append("(").append(method.getArguments()).append(") ");
		sb.append(method.getLevel()).append(" ");
		sb.append("[").append(operatorId).append("][").append(operatorName).append("][").append(operatorType).append("] ");
		sb.append(message);
		return sb.toString();
	}
}
